<?
	session_start();
	if (!$_SESSION['logged']) {		session_destroy();
		include ('../core/adds.php');
		include ('../user/config.php');

		if (($a_login === $_POST['a_login'])&&($a_pasw === $_POST['a_pasw'])) {
			session_start();
			session_regenerate_id();
			$_SESSION['logged'] = true;
			header("Location: index.php");
			die();
		} else {
			if ($_POST['a_login'] != "") $wrong_login = true;
		}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"[]>
<html>

<head>
	<title>Вход</title>
	<meta http-equiv="Content-Language" content="ru">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<body>
<form name="main_form" action="index.php" method="POST">
<div style="width:99%; text-align:center; top:30%;position:absolute;">
	<div class="align_center" style="display:block; margin: 0 auto 0 auto;width:250px;">
				<?
				if ($wrong_login) {print '<span style="color:red;">Неверное имя пользователя или пароль</span>';}
				?>

				<table>
					<tr><td class="login_label">логин:</td><td><input name="a_login" class="text_input" type="text" value="<? print $login; ?>"></td></tr>
					<tr><td class="login_label">пароль:</td><td><input name="a_pasw" class="text_input" type="password" value=""></td></tr>
					<tr><td class="login_button" colspan="2"><input class="button" type="submit" value="Вход"></td></tr>
				</table>

	</div>
</div>
</form>
</body>

</html>
<?
	} else {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  <title>Админка</title>
</head>
<frameset rows="*" cols="215px,*">
	<frame src="menu.php" name="menuFrame" noresize>
	<frame src="" name="workFrame" noresize>
</frameset>

</html>
<? } ?>